package com.zdp.degisn.pipe_filter.filter.impl;

import com.zdp.degisn.pipe_filter.entity.SickNoteContext;
import com.zdp.degisn.pipe_filter.filter.Filter;
import com.zdp.degisn.pipe_filter.service.StudentService;

import java.util.Calendar;
import java.util.Date;

/**
 * @author zhengdp
 * @Description
 * @Date 2022/8/28 18:16
 * @Created by zhengdp
 */
public class StudentFilter implements Filter<SickNoteContext> {

    private StudentService studentService;

    @Override
    public void doHandle(SickNoteContext context) {
        System.out.println("学生前置处理");
        // 学生填写请假条内容
        //studentService.fillSickNode(context);
        context.getSickNote().setContent("我生病了要请假");
        context.getSickNote().setApplicantName("申请人：学生1");
        context.getSickNote().setStart(new Date());
        Calendar instance = Calendar.getInstance();
        instance.add(Calendar.DATE,1);
        context.getSickNote().setEnd(instance.getTime());
    }

    @Override
    public void afterHandle(SickNoteContext context) {
        System.out.println("学生后置处理");
    }

    @Override
    public String getFilterName() {
        return "StudentFilter";
    }

    @Override
    public int getOrder() {
        return 0;
    }
}
